fix(session): recover stale encrypted reasoning - #48918
1837620622 wants to merge 1 commit into
Conversation
Retry once after stripping caller-bound reasoning.encrypted_content when the provider rejects it, matching overflow recovery.
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found: PR #48908 - Why it might be related: Note: PR #43595 |
|
This bricks Muse Spark 1.3 on 1.18.30 when resuming an old session. Tests in packages/core session-runner pass. Please review/merge when you can. |
|
hopefully |
|
I got that error message too now, what helps is using |
|
still persists on 1.18.31. I hope this gets merged soon. |
Why this mattersResuming after idle still bricks sessions with stale EvidenceTwo open recoveries for stale encrypted reasoning (
Community still sees the brick on 1.18.31 (thread on #48918). Architecture (proposal)Maintainer call: which shape should land on |
Retry once after stripping caller-bound reasoning.encrypted_content when the provider rejects it, matching overflow recovery. Adapted from PR anomalyco#48918 by 传康Kk <1837620622@qq.com>. Fork scope: core runner + @opencode-ai/llm classifier + tests only. The packages/opencode legacy processor path from the PR is intentionally excluded (heavily diverged in this fork and out of Wave Q scope). Type-only adaptation: SessionStaleReasoning.stripOpenaiReplay is typed against the schema ProviderMetadata shape to satisfy this fork's tsgo.
Retry once after stripping caller-bound reasoning.encrypted_content when the provider rejects it, matching overflow recovery. This ports the packages/opencode side of PR anomalyco#48918 (server handler -> SessionPrompt -> SessionProcessor -> llm) that Wave Q intentionally left out. Adapted from PR anomalyco#48918 by 传康Kk <1837620622@qq.com> (V1-path port, Wave R). Fork scope: provider/error.ts classifier, session/stale-reasoning.ts sanitizer, session/processor.ts retry-once hook, message-v2.ts serialization, and tests. Adaptation: processor.ts diverged ~+329 lines from the merge-base, so the hook was mirrored onto the fork's retry/backoff + finalizeRetryInflight structure instead of cherry-picking. outputStarted()/recoverStaleReasoning follow upstream.
|
+1 for shipping this — it fixes a real production brick (Muse Spark sessions failing with We vendored this recovery into our fork and verified it end-to-end. One detail worth noting: live sessions still drain through the V1 path (
Regression on our branch: opencode |
Issue for this PR
Fixes #48915
Type of change
What does this PR do?
Resuming a Muse Spark / OpenAI Responses session after idle fails with:
OpenCode stored that caller-bound blob and treated HTTP 400 as fatal, so the session stayed bricked.
This follows the existing context-overflow recovery path:
stale-reasoningreasoningEncryptedContent/itemIdfrom stored reasoningReadable reasoning text stays. Live tool-loop encrypted state is left alone unless the provider rejects it.
Related: #48741, #48805
How did you verify your code works?
packages/llm:bun test test/provider-error.test.tspackages/opencode:bun test test/provider/error.test.tsand the fromError case intest/session/message-v2.test.tspackages/core:bun test test/session-runner.test.ts(90 pass), including three new recovery tests plus existing overflow and encrypted-reasoning testsScreenshots / recordings
n/a (non-UI)
Checklist